package com.gxa.service.impl.fwgl.yhgl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.gxa.mapper.fwgl.yhgl.CheckInMapper;
import com.gxa.mapper.fwgl.yhgl.OldInfoMapper;
import com.gxa.pojo.dto.fwgl.CheckInDto;
import com.gxa.pojo.entity.fwgl.TCheckIn;
import com.gxa.pojo.entity.fwgl.TOldinfo;
import com.gxa.service.fwgl.yhgl.CheckInService;
import com.gxa.utils.QueryResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：lizhijun
 * @Package：{PROJECT_NAME}
 * @name：{DATE} {NAME}
 */
@Service
public class CheckInServiceImpl implements CheckInService {
    @Resource
    private CheckInMapper checkInMapper;
    @Override
    public QueryResult queryAll(CheckInDto checkInDto) {
        Page<TCheckIn> page = PageHelper.startPage(checkInDto.getPage(),checkInDto.getLimit());
        List<TCheckIn> checkInList = checkInMapper.queryAll(checkInDto);
        QueryResult queryResult = new QueryResult();
        queryResult.setCount(page.getTotal());
        queryResult.setData(checkInList);
        System.out.println(checkInList);
        return queryResult;
    }

    @Override
    public void add(TCheckIn checkIn) {
    checkInMapper.insertCheckIn(checkIn);
    }

    @Override
    public void update(TCheckIn checkIn) {
     checkInMapper.updateCheckIn(checkIn);
    }

    @Override
    public void delete(int id) {
     checkInMapper.deleteCheckIn(id);
    }

    @Override
    public TOldinfo findByName(String patientName) {
        return null;
    }
}
